package org.dromara.Nyt7PolicyInsurance.domain.vo;

import org.dromara.Nyt7FarmerInsuranceInfo.domain.vo.Nyt7FarmerInsuranceInfoVo;
import org.dromara.Nyt7PlotDetailInfo.domain.vo.Nyt7PlotDetailInfoVo;
import org.dromara.Nyt7PolicyInsurance.domain.Nyt7PolicyInsurance;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.system.domain.SysPost;
import org.dromara.system.domain.vo.SysPostVo;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;



/**
 * 保单查询视图对象 nyt_7_policy_insurance
 *
 * @author Lion Li
 * @date 2025-01-09
 */
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = Nyt7PolicyInsurance.class)
public class Nyt7PolicyInsuranceVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @ExcelProperty(value = "id")
    private Long id;

    /**
     * 保单号
     */
    @ExcelProperty(value = "保单号")
    private String policyNumber;

    /**
     * 投保标识
     */
    @ExcelProperty(value = "投保标识")
    private String insuranceIdentifier;

    /**
     * 投保总户数
     */
    @ExcelProperty(value = "投保总户数")
    private Long totalInsuredHouseholds;


    /**
     * 作物代码
     */
    @ExcelProperty(value = "作物代码")
    private String cropCode;

    /**
     * 险种代码
     */
    @ExcelProperty(value = "险种代码")
    private String insuranceTypeCode;

    /**
     * 总承包面积
     */
    @ExcelProperty(value = "总承包面积")
    private Double totalContractArea;

    /**
     * 保费总额
     */
    @ExcelProperty(value = "保费总额")
    private BigDecimal totalPremium;

    /**
     * 用户自缴总额
     */
    @ExcelProperty(value = "用户自缴总额")
    private BigDecimal totalSelfPaidByUser;

    /**
     * 中央财政补贴总额
     */
    @ExcelProperty(value = "中央财政补贴总额")
    private BigDecimal totalCentralFiscalSubsidy;

    /**
     * 省级财政补贴总额
     */
    @ExcelProperty(value = "省级财政补贴总额")
    private BigDecimal totalProvincialFiscalSubsidy;

    /**
     * 地市财政补贴总额
     */
    @ExcelProperty(value = "地市财政补贴总额")
    private BigDecimal totalMunicipalFiscalSubsidy;

    /**
     * 区县财政补贴总额
     */
    @ExcelProperty(value = "区县财政补贴总额")
    private BigDecimal totalDistrictAndCountyFiscalSubsidy;

    /**
     * 其他财政补贴总额
     */
    @ExcelProperty(value = "其他财政补贴总额")
    private BigDecimal totalOtherFiscalSubsidies;

    /**
     * 保险公司id
     */
    @ExcelProperty(value = "保险公司id")
    private Long postId;

    /**
     * 地块id
     */
    @ExcelProperty(value = "地块id")
    private Long plotId;

    /**
     * 农户id
     */
    @ExcelProperty(value = "农户id")
    private Long farmerId;

    /**
     * 创建时间
     */
    @ExcelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 保险公司
     */
    private SysPostVo sysPost;

    /**
     * 地块信息
     */
    private Nyt7PlotDetailInfoVo plotDetailInfo;

    /**
     * 农户信息
     */
    private Nyt7FarmerInsuranceInfoVo farmerInsuranceInfo;

    public void addFields(Nyt7PolicyInsuranceVo other) {
        this.totalInsuredHouseholds += other.getTotalInsuredHouseholds();
        this.totalContractArea += other.getTotalContractArea();
        this.totalPremium = this.totalPremium.add(other.getTotalPremium());
        this.totalSelfPaidByUser = this.totalSelfPaidByUser.add(other.getTotalSelfPaidByUser());
        this.totalCentralFiscalSubsidy = this.totalCentralFiscalSubsidy.add(other.getTotalCentralFiscalSubsidy());
        this.totalProvincialFiscalSubsidy = this.totalProvincialFiscalSubsidy.add(other.getTotalProvincialFiscalSubsidy());
        this.totalMunicipalFiscalSubsidy = this.totalMunicipalFiscalSubsidy.add(other.getTotalMunicipalFiscalSubsidy());
        this.totalDistrictAndCountyFiscalSubsidy = this.totalDistrictAndCountyFiscalSubsidy.add(other.getTotalDistrictAndCountyFiscalSubsidy());
        this.totalOtherFiscalSubsidies = this.totalOtherFiscalSubsidies.add(other.getTotalOtherFiscalSubsidies());
    }


}
